const url = 'https://www.baidu.com/search?name=jeff&age=32&sex=male#top';

function getSearch(url) {
  const urlInfos = new URL(url);
  const search = new URLSearchParams(urlInfos.search);
  console.log(search);
  console.log(Object.prototype.toString.call(search));
  console.log(Object.fromEntries(search));
  console.log(Object.entries(Object.fromEntries(search)));

  return Object.fromEntries(search);
}

getSearch(url);
